package com.ease.common.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 
 * @author nathanleewei
 * 
 */
@Entity
@Table(name = "blog", catalog = "search")
public class JpaAnnotatedBlog implements Serializable {

	/**
	 *
	 */
	private static final long serialVersionUID = -5377103401144285508L;

	// Fields
	@Id
	@GeneratedValue(generator = "autoincrement", strategy = GenerationType.AUTO)
	private Integer blogid;
	private String author;
	private String subject;
	private String content;
	private String publishTime;

	// Constructors
	/** default constructor */
	public JpaAnnotatedBlog() {
	}

	/** minimal constructor */
	public JpaAnnotatedBlog(Integer blogid, String author) {
		this.blogid = blogid;
		this.author = author;
	}

	/** full constructor */
	public JpaAnnotatedBlog(Integer blogid, String author, String subject, String content, String publishTime) {
		this.blogid = blogid;
		this.author = author;
		this.subject = subject;
		this.content = content;
		this.publishTime = publishTime;
	}

	// Property accessors
	@Id
	@Column(name = "blogid", nullable = false)
	public Integer getBlogid() {
		return this.blogid;
	}

	public void setBlogid(Integer blogid) {
		this.blogid = blogid;
	}

	@Column(name = "author", nullable = false, length = 25)
	public String getAuthor() {
		return this.author;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	@Column(name = "subject", length = 50)
	public String getSubject() {
		return this.subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	@Column(name = "content", length = 500)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(name = "publishTime", length = 25)
	public String getPublishTime() {
		return this.publishTime;
	}

	public void setPublishTime(String publishTime) {
		this.publishTime = publishTime;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((author == null) ? 0 : author.hashCode());
		result = prime * result + ((blogid == null) ? 0 : blogid.hashCode());
		result = prime * result + ((content == null) ? 0 : content.hashCode());
		result = prime * result + ((publishTime == null) ? 0 : publishTime.hashCode());
		result = prime * result + ((subject == null) ? 0 : subject.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final JpaAnnotatedBlog other = (JpaAnnotatedBlog) obj;
		if (author == null) {
			if (other.author != null)
				return false;
		} else if (!author.equals(other.author))
			return false;
		if (blogid == null) {
			if (other.blogid != null)
				return false;
		} else if (!blogid.equals(other.blogid))
			return false;
		if (content == null) {
			if (other.content != null)
				return false;
		} else if (!content.equals(other.content))
			return false;
		if (publishTime == null) {
			if (other.publishTime != null)
				return false;
		} else if (!publishTime.equals(other.publishTime))
			return false;
		if (subject == null) {
			if (other.subject != null)
				return false;
		} else if (!subject.equals(other.subject))
			return false;
		return true;
	}
}